package com.qinggeng.project.api.utils;

import com.qinggeng.common.utils.StringUtils;
import com.vdurmont.emoji.EmojiParser;

/**
 * @author 吴鹏飞
 * @date 2020/12/10
 * 过滤表情
 */
public class EmojiUtils {

    public static String filter(String str){
        String s = EmojiParser.removeAllEmojis(str);
        String result = filterEmoji(s, "");
        return result;
    }
    public static String filterEmoji(String source,String slipStr) {
        if(StringUtils.isNotBlank(source)){
            return source.replaceAll("[\\ud800\\udc00-\\udbff\\udfff\\ud800-\\udfff]", slipStr);
        }else{
            return source;
        }
    }
}
